Previous Page

nihilist - 00 / 00 / 00

PHP LainSafe

Before we start, you will need a Debian 10+ VPS (you can get one on digitalocean for example), if you prefer to use your own self hosted server, make sure that port 80 and 443 are correctly port forwarded so that the public ip points to the server and not the router. Once that's done, go and ssh into your debian 10 server.

Initial Setup


apt update -y && apt upgrade -y
apt install nginx php7.4-fpm curl php7.4-common socat -y
systemctl enable --now nginx php7.4-fpm

Next get yourself a domain name, you can use DuckDNS

Nginx Configuration



Next configure nginx:


mkdir /var/www/html/filesafe
mkdir /var/www/html/filesafe/uploads/

wget https://blog.nowhere.moe/servers/phpfilesafe/phpfilesafe.conf -O /etc/nginx/conf.d/phpfilesafe.conf

wget https://blog.nowhere.moe/servers/phpfilesafe/logo.png -O /var/www/html/filesafe/logo.png
wget https://blog.nowhere.moe/wallpaper.png -O /var/www/html/filesafe/wallpaper.png
wget https://blog.nowhere.moe/servers/phpfilesafe/html/index.php -O /var/www/html/filesafe/index.php
wget https://blog.nowhere.moe/servers/phpfilesafe/html/style.css -O /var/www/html/filesafe/style.css
wget https://blog.nowhere.moe/servers/phpfilesafe/html/upload.php -O /var/www/html/filesafe/upload.php

cd /var/www/html/filesafe
chown -R www-data: .

Then get your free letsencrypt certificate using acme.sh:


wget -O -  https://get.acme.sh | sh
source ~/.bashrc


systemctl stop nginx 
acme.sh --issue --standalone -d ech2.duckdns.org -k 4096
systemctl start nginx 

nano /etc/nginx/conf.d/phpfilesafe.conf

Edit the nginx config to have your own domain name:

Once you're done, hit CTRL+S to save and CTRL+X to exit nano and just reload nginx, and view the website:

End Result



Reload the nginx configuration since we modified it:


nginx -t
nginx -s reload

Then just browse to your website:

And you're done! just upload your files (png, jpg, jpeg, pdf) (you can edit the extensions you want in upload.php)

If you want you can also edit the maximum filesize in the upload.php file (line 36)

Nihilism

Until there is Nothing left.



Creative Commons Zero: No Rights Reserved

About nihilist

Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8


Contact: nihilist@contact.nowhere.moe (PGP)